#
# Python simple browser plugin

from sys import argv, exit
from os import walk
from os.path import join
from fnmatch import fnmatch

#
# make stuff go now:
#
# TODO - check that the file is readable.
# TODO - make the matching faster (regular expression), and better. Currently
#		we don't match against ".c" or ".hpp" files (there are probably others).
#
def makeStuffGoNow(root):
	for root,dirs,files in walk(rootDir):
		# for each file, check that it matches the pattern:
		for file in files:
			if fnmatch(file, "*.h") or fnmatch(file, "*.cpp"):
				# for now, just return the filename:
				print join(root,file)

if __name__ == "__main__":
	if "--name" in argv:
		print "simple"
		exit(0)
	if "--explain" in argv:
		print '''Reports all C/C++ files in the source tree based on file extension. No filtering whatsoever.'''
		exit(0)
	if "--lc" in argv:
		exit(0) # don't need any configuration!
	if "--rootDir" in argv:
		rootDir = argv[argv.index("--rootDir") + 1]
		makeStuffGoNow(rootDir)
